package com.app.TCES.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.app.TCES.domain.ST_indicators;
import com.app.TCES.domain.Student;
import com.app.TCES.domain.Teacher_Course;
import com.app.TCES.domain.Test;

@Mapper
public interface StudentMapper {
	
	//查教师和课程
    @Select("select c.courseName,t.tchName from student s,course c,class_course cc,teacher t where s.classId = cc.classId and c.courseId = cc.courseId and cc.tchId = t.tchId and s.stuId = #{stuId}")
	List<Teacher_Course> selectC(@Param("stuId")Object object);
	
	
    @Update("update student set password = #{student.password} where stuId=#{student.stuId}")
	void StuCGPW(@Param("student")Student student);

    
    //查询学生的教师及课程(条件:stuId)
    @Select("SELECT t.tchId,t.tchName,co.courseName from student s,class cl,teacher t,course co,class_course cc where s.classId=cl.classId and cl.classId=cc.classId and t.tchId=cc.tchId and co.courseId=cc.courseId and s.stuId=#{stuId}")
    List<Teacher_Course> selectTeacherBy_stuId(@Param("stuId")Object object);
    
    //获取学生评价问题内容
    @Select("select * from test where testType=2")
    List<Test> selectStudentTest();

    //学生给教师评分
    @Insert("insert into ST_indicators(teacherId,stuId,score) values(#{teacherId},#{stuId},#{score})")
    void insertST(@Param("teacherId")int tchId,@Param("stuId")Object object,@Param("score")double score);
    
    //通过学生查询已评价的教师(stuId)
    @Select("select * from ST_indicators where stuId=#{stuId}")
    List<ST_indicators> selectIndicators(@Param("stuId")Object object);
    
}
